# /usr/bin/python3
# coding=utf-8
# @Time:2025/11/12 17:28
# @Author: cc

from base.ObjectMap import ObjectMap
from base.AccountBase import AccountBase
from selenium.webdriver.common.by import By
from common.tools import get_img_path


class AccountPage (ObjectMap, AccountBase) :
    def upload_avatar(self, driver, img_name) :
        '''
        上传个人资料
        :param driver:
        :param img_name:
        :return:
        '''
        img_path = get_img_path (img_name)
        avatar_xpath = self.basc_info_avatar_input ( )
        return self.upload (driver, By.XPATH, avatar_xpath, img_path)

    def click_save(self, driver) :
        '''
        点击保存
        :param driver:
        :return:
        '''
        click_save_button_xpath = self.basic_info_save_button ( )
        return self.element_click (driver, By.XPATH, click_save_button_xpath)

    def suspended_avatar_click(self, driver) :
        '''
        鼠标放置头像处的悬浮操作
        :param driver:
        :return:
        '''
        suspend_xpath = self.suspend_avatar ( )
        return self.suspended (driver, By.XPATH, suspend_xpath)

    def click_exit_login(self, driver) :
        '''
        退出登录
        :param driver:
        :return:
        '''
        exit_login_xpath = self.exit_login ( )
        return self.element_click (driver, By.XPATH, exit_login_xpath)
